package com.dcd.service.impl;

import com.dcd.mapper.Collection_videoMapper;
import com.dcd.pojo.Collection_video;
import com.dcd.pojo.Video;
import com.dcd.service.Collection_videoService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class Collection_videoServiceImpl implements Collection_videoService {

    @Autowired(required = false)
    private Collection_videoMapper cvm;

    /**
     * 根据登入用户id查询所有视频集合
     * @param user_id 登入用户id
     * @return
     */
    @Override
    public List<Collection_video> select_collection_videoList_byId(Integer user_id) {
        return cvm.select_collection_videoList_byId(user_id);
    }

    /**
     * 添加收藏
     * @param collection_video 收藏表对象
     * @return
     */
    @Override
    public boolean add_collection_video(Collection_video collection_video) {
        return cvm.add_collection_video(collection_video)==1;
    }

    /**
     * 取消收藏
     * @param collection_video 收藏表对象
     * @return
     */
    @Override
    public boolean delete_collection_video(Collection_video collection_video) {
        return cvm.delete_collection_video(collection_video)>0;
    }

    /**
     * 查询登录id 是否收藏了该视频   视频播放页
     * @param collection_video 收藏表对象
     * @return
     */
    @Override
    public boolean select_voider_broadcast(Collection_video collection_video) {
        return cvm.select_voider_broadcast(collection_video)>0;
    }
}
